<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Thymeleaf入门</title>
</head>
<body>
<!--输出hello数据-->
========= 输出数据 =========
<p th:text="${hello}"></p>

<br/>
========= 表单传参 =========
<br/>

<form th:action="@{/test/hello}">
    <input th:type="text" th:name="id"/>
    <button>提交</button>
</form>

<br/>
========= 遍历输出 =========
<br/>

<table>
    <tr>
        <td>下标</td>
        <td>编号</td>
        <td>姓名</td>
        <td>地址</td>
    </tr>
    <tr th:each="user,userStat:${users}">
        <td>
            <!--下标从0开始-->
            下标：<span th:text="${userStat.index}"></span>,
        </td>
        <td th:text="${user.id}"></td>
        <td th:text="${user.name}"></td>
        <td th:text="${user.address}"></td>
    </tr>
</table>

<br/>
========= Map输出 =========
<br/>

<div th:each="map,mapStat:${dataMap}">
    <div th:text="${map}"></div>
    --- <br>
    key:<span th:text="${mapStat.current.key}"></span> <br>
    value:<span th:text="${mapStat.current.value}"></span> <br>
    ------
</div>

<br/>
========= 数组输出 =========
<br/>

<div th:each="nm,nmStat:${names}">
    <span th:text="${nmStat.count}"/>
    <span th:text="${nm}"/>
</div>

<br/>
========= 日期时间输出 =========
<br/>

<div>
    <span th:text="${#dates.format(now,'yyyy-MM-dd hh:ss:mm')}"></span>
</div>


<br/>
========= if条件判断输出 =========
<br/>

<div>
    <span th:if="${age > 18}">成年人了，哎！</span>
</div>

<br/>
========= 包含页面到当前页面 =========
<br/>

<div th:include="footer::copy"></div>
<br>
<div th:include="footer::link"></div>

</body>
</html>